// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-11-16

#ifndef __SVR_CONFIG_H_COMMON_SVR_BASE__
#define __SVR_CONFIG_H_COMMON_SVR_BASE__

#pragma once

#include <common/base/thread.h>
#include <common/base/utility.h>

#pragma comment(lib, "Iphlpapi.lib")

namespace JoyServer
{

class CJoyServer;
class CJoyDbSource;
class CJoyDbCommand;

class CJoyServerConfig
{
protected:
    typedef CMap<CString, const CString&, CString, CString&> CDbInitMap;

    CJoyCriticalSection m_lock;
    CDbInitMap  m_dbInitStrings;

    virtual CString GetServerConfigPath() = 0;

    virtual bool LoadDbInitStrings();
    virtual bool LoadServerAttributes();
public:
    UINT        m_serverId;
    CString     m_serverIP;
    CJoyServer* m_server;
public:
    CJoyServerConfig();
    virtual ~CJoyServerConfig();

    virtual bool Create();
    virtual void Destroy();

    const CString& GetDbInitString(PCSTR connName);

};

} // namespace JoyServer

#endif  // __SVR_CONFIG_H_COMMON_SVR_BASE__